#ifndef _RefractionMaterial_H_
#define _RefractionMaterial_H_

#pragma once
#include "Material.h"

class RefractionMaterial : public Material {
protected:
	shared_ptr<Material> material;
	Double ior, iorSqr;

public:
	RefractionMaterial(Double ior, Float refractionIntensity = 1) : Material(refractionIntensity), ior(ior), iorSqr(ior * ior) {}
	RefractionMaterial(shared_ptr<Material> material, Double ior, Float refractionIntensity = 1) : Material(refractionIntensity), material(material), iorSqr(ior * ior), ior(ior) {}
	~RefractionMaterial() {}

	virtual Color shade(const Scene *scene, const Ray &ray, const IntersectResult &intersect, const TraceState & traceState) const;

	bool isTransparent() const {
		return true;
	}
	Color getTransparentColor(const Scene * scene, const Ray & ray, const IntersectResult &intersect) const;
};

#endif // _RefractionMaterial_H_